package com.bdsy.system.web.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bdsy.common.annotation.Json;
import com.bdsy.system.service.UserLogService;
import com.bdsy.system.session.StringUtils;

/**
 * ClassName:UserController
 * Description: TODO 添加描述.
 * @author   Administrator
 * @version  
 * @since    JDK 1.8
 */
@Controller
@RequestMapping(value = "${web.adminPath}")
public class UserLogController {
    
	@Autowired
	UserLogService userLogService;
    
	@RequestMapping(value="sysuserlog")
	public String sysuser(HttpServletRequest request, HttpServletResponse response, Model model) {
		return "admin/system/sysuserlog";
	}
	
	@SuppressWarnings("rawtypes")
	@Json
	@RequestMapping(value="queryUserLog")
	public List<Map> queryCondition(String username,String fromDate,String toDate){
		if(!StringUtils.isBlank(username)){
			username=username.trim();
		}
		if(!StringUtils.isBlank(fromDate)){
			fromDate = fromDate + " 00:00:00";
		}
		if(!StringUtils.isBlank(toDate)){
			toDate = toDate + " 23:59:59";
		}
		List<Map> list = userLogService.getUserLogByQuery(username, fromDate, toDate);
		return list;
	}
}

